/**
 * PaperListController.java
 * Version 1.0.0
 * Created on 2018年7月16日
 *
 */
package com.yincheng.oes.business.exam.createpaper;

import java.util.List;

import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yincheng.oes.business.util.Tools;

/**
 * @author yangsy
 * @version 1.0.0
 * @since
 * 创建时间：2018年7月16日
 * 功能描述：
 * 邮箱地址：446948434@qq.com
 */
@Controller
@RequestMapping("/paperList")
public class PaperListController {

    @Autowired
    private PaperListService paperListService;

    /**
     * 获取试卷列表展示页面
     *
     * @param model
     * @return
     */
    @RequestMapping(value = "/paperListPage.html", method = RequestMethod.GET)
    public String quesListPage(Model model) {
        return "business/paper/paperlist";
    }

    /**
     * 根据参数获取试卷列表数据
     *
     * @param bean
     * @return
     */
    @RequestMapping(value = "/getList.json", method = RequestMethod.GET)
    @ResponseBody
    public String list(QueryParamBean bean) {
        Pair<Integer, List<QueryResultRow>> pair = paperListService.getPaperListByParam(bean);
        return Tools.toEasyuiDataGrid(pair.getLeft(), pair.getRight());
    }
}
